﻿#r @"..\Microsoft.SharePoint.Client (spo)\Microsoft.SharePoint.Client.dll"
#r @"..\Microsoft.SharePoint.Client (spo)\Microsoft.SharePoint.Client.Runtime.dll"
#r @"..\Microsoft.SharePoint.Client (spo)\Microsoft.Online.SharePoint.Client.Tenant.dll"

#load "Client.fs"

open Client
open Microsoft.SharePoint.Client
open Microsoft.Online.SharePoint.TenantAdministration
open Microsoft.SharePoint.Client.Application
open System.Security
open System.Net
open System
    
// =======================================================
// Create new site collections
// =======================================================

let web = Client.Context.Web
Client.Load web

Client.Context.Web

let tenant = new Tenant(Client.Context);
Client.Load tenant

let siteCreationProperties = new SiteCreationProperties();

siteCreationProperties.Url <- "https://geek.sharepoint.com/sites/test";
siteCreationProperties.Title <- "test"
siteCreationProperties.Owner <- "me@geek.onmicrosoft.com"
siteCreationProperties.Template <- "STS#0"
siteCreationProperties.StorageMaximumLevel <- Convert.ToInt64(500);
siteCreationProperties.UserCodeMaximumLevel <- Convert.ToDouble(0);

let spo = tenant.CreateSite(siteCreationProperties);
Client.Load spo

let spp = tenant.GetSiteProperties(0,true);
Client.ExecuteQuery();
